package com.example.service.impl;

import com.example.common.Pager;
import com.example.exception.LibraryManagerException;
import com.example.mapper.SuperMapper;
import com.example.service.SuperService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 紫煦桉
 */
@Service
public abstract class AbstractSuperServiceImpl<T> implements SuperService<T> {

    private SuperMapper<T> superMapper;

    @Autowired
    private void setSuperMapper(SuperMapper<T> superMapper) {
        this.superMapper = superMapper;
    }

    @Override
    public List<T> findList(Pager<T> pager) throws LibraryManagerException {
        return superMapper.findList(pager);
    }

    @Override
    public int findTotal(Pager<T> pager) throws LibraryManagerException {
        return superMapper.findTotal(pager);
    }

    @Override
    public List<T> findAll() throws LibraryManagerException {
        return superMapper.findAll();
    }

    @Override
    public boolean add(T param) throws LibraryManagerException {
        return superMapper.add(param);
    }

    @Override
    public boolean edit(T param) throws LibraryManagerException {
        return superMapper.edit(param);
    }

    @Override
    public boolean delete(T param) throws LibraryManagerException {
        return superMapper.delete(param);
    }
}
